package org.example.controller;

import org.example.service.WebSocketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.messaging.simp.SimpMessagingTemplate;

/**
 * @Author 李荣
 * @Date 2025/1/20
 * @Description
 */
@RestController
public class WebSocketController {

    @Autowired
    private WebSocketService webSocketService;

    //接受send发送的消息，接受消息
    @MessageMapping("/send")
    //@SendTo("/topic/messages")
    public String sendMessage(Integer message) {
        webSocketService.handle(message);
        return "接收到数据，设备正在或重启";
    }

}
